\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f2\b0\i0\ul0\fs28 active application appkit main launch\
\
Q: How can I make an application launch and become the active app?\
Q: Why don't I get
\b windowDidBecomeKey
\b0 and
\b windowDidBecomeMain
\b0 messages when my application is launched? \
\
A:
\fc0 Normally, applications should not need to ever worry about activating themselves. When Workspace launches an application it deactivates itself, and then it activates the application as its completes the launch. It sends the application the message
\b activateSelf:
\b0 NO and this results in the behavior where the application will become active if the user waits for it, but will not interrupt the user by becoming active if the user began using a different application in the meantime.\
\
The reason for this is the need for predictable consistent behavior in a multitasking system. Imagine you double-click an Edit file. Edit begins to launch. You activate Shell and start typing. When Edit finishes launching, do you want it to take over as the active app and suddenly start grabbing the keystrokes you intended for Shell? Probably not. Edit will only become the active app if you wait for it to launch and don't activate another app.\
\
A: You also will not receive
\b windowDidBecomeKey
\b0 and
\b windowDidBecomeMain
\b0 messages until your application becomes active. The key and main window of an app have no meaning when the app is inactive. \